package com.project.common.enums;

/**
 * 颜色
 */
public enum ColorEnum {
    //   0 白 ,1 黑,2 红,3 黄 ,4 灰,5 蓝,6 绿,7 橙,8 紫 ,9 青 ,10 粉 ,11 棕 ,100 其他
    WHITE("0", "白"),
    BLACK("1", "黑"),
    RED("2", "红"),
    YELLOW("3", "黄"),
    GREY("4", "灰"),
    BLUE("5", "蓝"),
    GREEY("6", "绿"),
    ORANGE("7,", "橙"),
    PURPLE("8", "紫"),
    GRASS("9", "青"),
    PINK("10", "粉"),
    PALM("11", "棕"),
    OTHER("12", "其他");

    private final String code;
    private final String desc;

    private ColorEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public static String getDescByCode(String code) {
        for (ColorEnum e : values()) {
            if (e.code.equals(code)) {
                return e.desc;
            }
        }
        return null;
    }
}
